package org.aiforum.web.action;

import org.aiforum.domain.User;
import org.aiforum.frountend.common.Response;
import org.aiforum.frountend.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户异步请求Action
 * @author VIC
 *
 */
public class UserAjaxAction {
	
	// 创建请求对象
	private User user = new User();
	
	// 创建业务接口对象
	@Autowired
	private UserService userService;
	
	// 响应对象(被json插件转换成json字符串输出到浏览器中,必须添加get,set方法)
	private Response response;
	
	/**
	 * 异步验证账号是否被占用
	 * @return
	 */
	public String checkAccount(){
		// 调用用户业务接口执行检查
		System.out.println(user);
		response = userService.checkAccount(user);
		return "success";
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Response getResponse() {
		return response;
	}

	public void setResponse(Response response) {
		this.response = response;
	}

}